package com.neusoft.work.controller;

import java.util.concurrent.TimeUnit;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.work.service.RedisService;

@RestController
@RequestMapping("/RedisController")
public class RedisController {
	@Autowired
	private RedisService rd;
	
	@PostMapping("/save")
	public String save(String key,String val) {
		rd.set(key, val,90,TimeUnit.SECONDS);
		return "ok";
	}
	
	@GetMapping("read")
	public String read(String key) {
		return rd.get(key);
	}
}
